<?php

/**
 * Cadpedido form base class.
 *
 * @method Cadpedido getObject() Returns the current form's model object
 *
 * @package    SCBE
 * @subpackage form
 * @author     Your name here
 * @version    SVN: $Id: sfDoctrineFormGeneratedTemplate.php 29553 2010-05-20 14:33:00Z Kris.Wallsmith $
 */
abstract class BaseCadpedidoForm extends BaseFormDoctrine
{
  public function setup()
  {
    $this->setWidgets(array(
      'idpedido'               => new sfWidgetFormInputHidden(),
      'idpessoa'               => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Cadpessoa'), 'add_empty' => false)),
      'idnivelpedido'          => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Cadnivel'), 'add_empty' => false)),
      'idprojetos'             => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Cadprojetos'), 'add_empty' => false)),
      'idstatus'               => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Cadstatus'), 'add_empty' => false)),
      'nomecursopedido'        => new sfWidgetFormInputText(),
      'iespedido'              => new sfWidgetFormInputText(),
      'idareapedido'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Cadareaformacao'), 'add_empty' => false)),
      'datainiciopedido'       => new sfWidgetFormDate(),
      'dataterminopedido'      => new sfWidgetFormDate(),
      'idcidadepedido'         => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Cadcidade'), 'add_empty' => true)),
      'idpaispedido'           => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Cadpais'), 'add_empty' => true)),
      'idcidadepedidoexterior' => new sfWidgetFormDoctrineChoice(array('model' => $this->getRelatedModelName('Cadcidadeexterior'), 'add_empty' => true)),
      'motivoindeferimento'    => new sfWidgetFormTextarea(),
    ));

    $this->setValidators(array(
      'idpedido'               => new sfValidatorChoice(array('choices' => array($this->getObject()->get('idpedido')), 'empty_value' => $this->getObject()->get('idpedido'), 'required' => false)),
      'idpessoa'               => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Cadpessoa'))),
      'idnivelpedido'          => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Cadnivel'))),
      'idprojetos'             => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Cadprojetos'))),
      'idstatus'               => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Cadstatus'))),
      'nomecursopedido'        => new sfValidatorString(array('max_length' => 45)),
      'iespedido'              => new sfValidatorString(array('max_length' => 45)),
      'idareapedido'           => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Cadareaformacao'))),
      'datainiciopedido'       => new sfValidatorDate(array('required' => false)),
      'dataterminopedido'      => new sfValidatorDate(array('required' => false)),
      'idcidadepedido'         => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Cadcidade'), 'required' => false)),
      'idpaispedido'           => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Cadpais'), 'required' => false)),
      'idcidadepedidoexterior' => new sfValidatorDoctrineChoice(array('model' => $this->getRelatedModelName('Cadcidadeexterior'), 'required' => false)),
      'motivoindeferimento'    => new sfValidatorString(array('required' => false)),
    ));

    $this->widgetSchema->setNameFormat('cadpedido[%s]');

    $this->errorSchema = new sfValidatorErrorSchema($this->validatorSchema);

    $this->setupInheritance();

    parent::setup();
  }

  public function getModelName()
  {
    return 'Cadpedido';
  }

}
